package org.jl.main;

import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.MutableTriple;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;

public class Main05_Return {

    public static void main() {
        System.out.println("string = " + getString());
        System.out.println("pair = " + getPair());
        System.out.println("triple = " + getTriple());
        System.out.println("mutablePair = " + getMutablePair());
        System.out.println("mutableTriple = " + getMutableTriple());
    }

    private static String getString() {
        return "xiao ming";
    }

    private static Pair<String, Integer> getPair() {
        return Pair.of("xiao ming", 15);
    }

    private static Triple<String, Integer, String> getTriple() {
        return Triple.of("xiao ming", 15, "men");
    }

    //可变
    private static MutablePair<String, Integer> getMutablePair() {
        MutablePair<String, Integer> pair = new MutablePair<>("xiao ming", 15);
        pair.setLeft("xiao fang");
        pair.setRight(16);
        return pair;
    }

    //可变
    private static MutableTriple<String, Integer, String> getMutableTriple() {
        MutableTriple<String, Integer, String> pair = new MutableTriple<>("xiao ming", 15, "men");
        pair.setLeft("xiao fang");
        pair.setMiddle(16);
        pair.setRight("women");
        return pair;
    }

}
